const fs=require("fs");

//创建文件夹
fs.mkdir("test",{recursive:true},(err)=>{
    if(err){
        console.log(err);
    }
})

 const file=["test/a.txt","test/b.txt","test/c.txt","test/d.txt","test/e.txt","test/ab.txt","test/ac.txt","test/ad.txt","test/aa.txt","test/ae.txt"];
 const filea=["a.txt","b.txt","c.txt","d.txt","e.txt","ab.txt","ac.txt","ad.txt","aa.txt","ae.txt"];

 //创建文件
    file.forEach(era=>{
    fs.writeFile(era,"哈哈哈",err=>{
        if(err){
            console.log(err);
            return;
        }
        console.log("创建成功");
    })
   })

//读取文件
file.forEach(ere=>{
    fs.readFile(ere,"utf-8",(err,data)=>{
    console.log(data);
})
})
//重命名文件
let b=0;
file.forEach(iei=>{
    let test="test/"
    let a="0";
    let c="-";
    b++
    fs.rename(iei,test+a+b+c+filea[b-1],(err)=>{
        if(err){
        console.log(err);
       }
     })
})
